package com.mojo.jedis.pojo;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.StringJoiner;

/**
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2022, 广州九尾信息科技有限公司
 * @date 2022/2/22 16:06
 */
public class User implements Serializable {

    private String name;
    private int age;
    // 不需要
    // @JsonSerialize(using = LocalDateTimeSerializer.class)
    // @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime time;
    private LocalDate date;
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public LocalDate getDate() {
        return date;
    }

    public User setDate(LocalDate date) {
        this.date = date;
        return this;
    }

    public User() {
    }

    public User(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public User(String name, int age, LocalDateTime time) {
        this.name = name;
        this.age = age;
        this.time = time;
    }

    public LocalDateTime getTime() {
        return time;
    }

    public User setTime(LocalDateTime time) {
        this.time = time;
        return this;
    }

    public User(String name, int age, LocalDateTime time, LocalDate date) {
        this.name = name;
        this.age = age;
        this.time = time;
        this.date = date;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", User.class.getSimpleName() + "[", "]")
                .add("name='" + name + "'")
                .add("age=" + age)
                .add("time=" + time)
                .add("date=" + date)
                .toString();
    }
}

